package org.fujene.structure;

public class LookupPointer implements Comparable<LookupPointer>{
	// public byte flags;
	public int block;
	public int point;
	public long firstID;
	public int termfreq;

	public LookupPointer(){
		this.block = -1;
		this.point = -1;
	}

	public LookupPointer(int block, int point){
		this(block, point, -1L);
	}

	public LookupPointer(int block, int point, long ID){
		this(block, point, ID, -1);
	}

	public LookupPointer(int block, int point, long ID, int termfreq){
		this.block = block;
		this.point = point;
		this.firstID = ID;
		this.termfreq = termfreq;
	}

	public LookupPointer(int block, int point, int termfreq){
		this.block = block;
		this.point = point;
		this.termfreq = termfreq;
	}

	public String toString(){
		return new String("(" + this.block + ", " + this.point + ") from " + firstID);
	}

	public boolean equals(LookupPointer q){
		if (q.block == this.block && q.point == this.point) return true;
		return false;
	}

	@Override
	public int compareTo(LookupPointer query){
		if (query.block != this.block){
			return this.block - query.block;
		}else{
			if (query.point != this.point){
				return this.point - query.point;
			}else{
				return 0;
			}
		}
	}
}
